#!/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time : 2021/9/12 20:37
# @Author : lenovo
# @Email : 26541796406@qq.com
# @File : schedule_page.py
# @Project : crm
"""日程信息页面"""
from selenium.webdriver.common.by import By
from page.base_page import BasePage
from utils.util import HS3
class Schedule(BasePage):
    """日程首页类，一系列元素，以及操作"""
    url = "{}/crm3/index.php?m=event".format(HS3)
    """定义定位器"""
    add_schedule_locator = (By.XPATH, '/html/body/div[5]/div[2]/div[1]/div/a')  # 新建日程
    schedule_input_locator = (By.NAME, 'event_id[]')  # 单选框input
    all_schedule_input_locator = (By.ID, 'check_all')  # 全部勾选input
    schedule_del_locator = (By.LINK_TEXT, '删除')  # 删除按钮
    """具体操作"""
    def add_schedule(self):
        """新建日程"""
        self.driver.find_element(*self.add_schedule_locator).click()
    def input1(self):
        """第一个单选勾选框"""
        self.driver.find_elements(*self.schedule_input_locator)[0].click()
    def input2(self):
        """第一个单选勾选框"""
        self.driver.find_elements(*self.schedule_input_locator)[1].click()
    def all_input(self):
        """全选勾选框"""
        self.driver.find_element(*self.all_schedule_input_locator).click()
    def del_schedul(self):
        """删除日程按钮"""
        self.driver.find_element(*self.schedule_del_locator).click()